-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing most node traversal usages #3009
base: main
Are you sure you want to change the base?
Conversation
…odes() returned every node in pages in pageOrder, but nodeData included these implicitly hidden nodes. Removing generation of these nodes might break some use-cases, and I'll have to look into that more closely.
…This might have been a bug for a while!
…rect method. This failed hard _sometimes_ in the pdf.ts test, seemingly because the clearTimeout() that ran here failed hard when freezing clocks in cy.testPdf(). I have no idea what's going on, or why this suddenly happened now, but it seems like getting rid of more cruft fixes it.
…d to the backend before it continues to test the pdf.
…!== undefined check
…ng preselectedOptionIndex among others
… them as 'isValid: false' instead, and use that info to not include them in validation selectors.
…eAttachmentDeletionInRepGroups.ts
…ably cheaper to run now
…roupTable.test.tsx
|
const componentOptions = NodesInternal.useShallowSelector((state) => | ||
Object.values(state.nodeData).map((nodeData) => ({ | ||
label: nodeData.layout.id, | ||
value: `${nodeData.pageKey}|${nodeData.layout.id}`, | ||
})), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A shallow selector will not do anything in this case no? You are returning a list, so the elements of the list are shallow-compared for equality, but you are creating new objects to populate the list every time so it will always fail the equality check on the first element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely true! Sloppy mistake on my part. 🫣
NodesInternal.useEffectWhenReady(() => { | ||
useEffect(() => { | ||
if (shouldSelectOptionAutomatically) { | ||
if (nodeStore.getState().readiness !== NodesReadiness.Ready) { | ||
requestAnimationFrame(() => setForceUpdate((prev) => prev + 1)); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems like a quite the machine gun of re-renders 🤯 The original useEffectWhenReady
was a bit complex maybe, what was the issue here?
if (parent) { | ||
return isHidden(state, 'node', parent?.layout.id, options); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick, parent cannot be null 😅
if (parent) { | |
return isHidden(state, 'node', parent?.layout.id, options); | |
} | |
if (parent) { | |
return isHidden(state, 'node', parent.layout.id, options); | |
} |
@@ -308,6 +308,8 @@ describe('PDF', () => { | |||
}); | |||
|
|||
cy.goto('changename'); | |||
cy.get(appFrontend.changeOfName.newFirstName).should('be.visible'); | |||
cy.waitUntilSaved(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this needed for the test to pass? 🤯 testPdf
also waits for save before doing anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just curious about the implications of the useEffectWhenReady
-replacement in the three Effect*
-components
Description
My plan has, for a while, been to remove the node traversal concept entirely. When that 's done, we can also remove the
LayoutPages
,LayoutPage
and even theLayoutNode
object. At that point we can simplify the node hierarchy and refactor to remove the expression evaluation from the node generator.This is just one step along that road, removing some of the node traversal usages.
Related Issue(s)
Verification/QA
kind/*
label to this PR for proper release notes grouping